<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>POST</h1>
		<div id="div_01">
			<label id='lab01'>开发者注册</label>
			<br />
			用户名：<input type="" name="" id="user_name1" value="" />
			密码：<input type="" name="" id="user_pwd1" value="" />
			邮箱：<input type="" name="" id="user_e" value="" />
			<br />
			<button type="button" onclick="Developer_Register();">获取</button>
		</div>
		<div id="div_02">
			<label id='lab02'>开发者登陆</label>
			<br />
			用户名：<input type="" name="" id="user_name2" value="" />
			密码：<input type="" name="" id="user_pwd2" value="" />
			<br />
			<button type="button" onclick="Developer_Login();">获取</button>
		</div>
		<br />
		<div id="div_03">
			<label id='lab03'>用户注册</label>
			<br />
			开发者key:<input type="" name="" id="key_1" value="" />
			用户名：<input type="" name="" id="user_name3" value="" />
			密码：<input type="" name="" id="user_pwd3" value="" />
			<br />
			昵称:<input type="" name="" id="nike_Name" value="" />
			头像:<input type="" name="" id="header_Img" value="" />
			手机:<input type="" name="" id="phone_id" value="" />
			<br />
			邮箱 :<input type="" name="" id="email_oo" value="" />
			vip等级:<input type="" name="" id="vip" value="" />
			签名:<input type="" name="" id="autograph_ic" value="" />
			<br />
			备注:<input type="" name="" id="remarks1" value="" />
			<br />
			<button type="button" onclick="User_Register();">获取</button>
		</div>
		<br />
		<div id="div_04">
			<label id='lab04'>删除反馈</label>
			<br />
			开发者KEY:<input type="" name="" id="key_dele" value="" />
			要删除的反馈ID:<input type="" name="" id="dele_id" value="" />
			<br />
			<button type="button" onclick="Delete_Feedback();">获取</button>
		</div>
		<br />
		<div id="div_05">
			<label id='lab05'>获取网易新闻</label>
			<br />
			页码:<input type="" name="" id="num1" value="" />
			返回总数:<input type="" name="" id="num2" value="" />
			<br />
			<button type="button" onclick="Weather();">获取</button>
		</div>
	</body>
	<script type="text/javascript">
		function Weather(){
			var WeatherAjax = new XMLHttpRequest();
			var Weatherdiv1 = document.getElementById('num1').value;
			var Weatherdiv2 = document.getElementById('num2').value;
			WeatherAjax.open('POST','https://api.apiopen.top/getWangYiNews');
			WeatherAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			WeatherAjax.send('page='+Weatherdiv1+'&count='+Weatherdiv2);
			WeatherAjax.onreadystatechange = function() {
				if (WeatherAjax.status == 200 && WeatherAjax.readyState == 4) {
					document.getElementById('lab05').innerText = WeatherAjax.responseText;
					var obj = JSON.parse(WeatherAjax.responseText);
					console.log(obj);
				}
			}
		}
		function Delete_Feedback(){
			var DeleteAjax = new XMLHttpRequest();
			var key_divg = document.getElementById('key_dele').value;
			var delete_div = document.getElementById('dele_id').value;
			DeleteAjax.open('POST','https://api.apiopen.top/deleteFeedback');
			DeleteAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			DeleteAjax.send('apikey='+key_divg+'&id='+delete_div);
			DeleteAjax.onreadystatechange = function() {
				if (DeleteAjax.status == 200 && DeleteAjax.readyState == 4) {
					document.getElementById('lab04').innerText = DeleteAjax.responseText;
					var obj = JSON.parse(DeleteAjax.responseText);
					console.log(obj);
				}
			}
		}
		function User_Register() {
			var key_var = document.getElementById('key_1').value;
			var user = document.getElementById('user_name3').value;
			var pwd = document.getElementById('user_pwd3').value;
			var Nc = document.getElementById('nike_Name').value;
			var Tx = document.getElementById('header_Img').value;
			var Sj = document.getElementById('phone_id').value;
			var Yx = document.getElementById('email_oo').value;
			var VIP = document.getElementById('vip').value;
			var Qm = document.getElementById('autograph_ic').value;
			var Bz = document.getElementById('remarks1').value;
			var DeveLogAjax = new XMLHttpRequest();
			DeveLogAjax.open('POST', 'https://api.apiopen.top/registerUser');
			DeveLogAjax.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
			DeveLogAjax.send('apikey=' + key_var + '&name=' + user + '&passwd=' + pwd + '&nikeName=' + Nc + '&headerImg=' +
				Tx + '&phone=' + Sj + '&email=' + Yx + '&vipGrade=' + VIP + '&autograph=' + Qm + '&remarks=' + Bz);
			DeveLogAjax.onreadystatechange = function() {
				if (DeveLogAjax.status == 200 && DeveLogAjax.readyState == 4) {
					document.getElementById('lab03').innerText = DeveLogAjax.responseText;
					var obj = JSON.parse(DeveLogAjax.responseText);
					console.log(obj);
				}
			}
		}
		function Developer_login() {
			var DeveLogAjax = new XMLHttpRequest();
			var user = document.getElementById('user_name2').value;
			var pwd = document.getElementById('user_pwd2').value;
			DeveLogAjax.open('POST', 'https://api.apiopen.top/developerLogin');
			DeveLogAjax.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
			DeveLogAjax.send('name=' + user + '&passwd=' + pwd);
			DeveLogAjax.onreadystatechange = function() {
				if (DeveLogAjax.status == 200 && DeveLogAjax.readyState == 4) {
					document.getElementById('lab02').innerText = DeveLogAjax.responseText;
					var obj = JSON.parse(DeveLogAjax.responseText);
					console.log(obj);
				}
			}
		}
		function Developer_Register() {
			var DeveRegAjax = new XMLHttpRequest();
			var user = document.getElementById('user_name1').value;
			var pwd = document.getElementById('user_pwd1').value;
			var mailbox = document.getElementById('user_e').value;
			DeveRegAjax.open('POST', 'https://api.apiopen.top/developerRegister');
			DeveRegAjax.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
			DeveRegAjax.send('name=' + user + '&passwd=' + pwd + '&email=' + mailbox);
			DeveRegAjax.onreadystatechange = function() {
				if (DeveRegAjax.status == 200 && DeveRegAjax.readyState == 4) {
					document.getElementById('lab02').innerText = DeveRegAjax.responseText;
					var obj = JSON.parse(DeveRegAjax.responseText);
					console.log(obj);
				}
			}
		}
	</script>
</html>
